package com.sptpc.myloginui;

import android.app.Activity;
import android.app.Fragment;
import android.os.Bundle;
import android.view.View;
import android.view.Window;
import android.widget.ImageView;

import androidx.annotation.Nullable;

import com.sptpc.myloginui.QQFragment.Contacts_QQFragment;
import com.sptpc.myloginui.QQFragment.Dynamic_QQFragment;
import com.sptpc.myloginui.QQFragment.Message_QQFragment;

public class QQmain extends Activity {

    ImageView Message;
    ImageView Contacts;
    ImageView Dynamic;
    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {

        super.onCreate(savedInstanceState);
        requestWindowFeature(Window.FEATURE_NO_TITLE);
        setContentView(R.layout.qqmain);
        Message = (ImageView)findViewById(R.id.Imgv1);
        Contacts = (ImageView)findViewById(R.id.Imgv2);
        Dynamic = (ImageView)findViewById(R.id.Imgv3);
        Message.setOnClickListener(Lc);
        Contacts.setOnClickListener(Lc);
        Dynamic.setOnClickListener(Lc);
    }
    View.OnClickListener Lc = new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            Fragment myFragment = null;
            switch (view.getId())
            {
                case R.id.Imgv1 :
                    myFragment = new Message_QQFragment();
                    break;
                case R.id.Imgv2:
                    myFragment = new Contacts_QQFragment();
                    break;
                case R.id.Imgv3:
                    myFragment = new Dynamic_QQFragment();
                    break;
                default:
                        break;
            }
            getFragmentManager().beginTransaction().replace(R.id.QQFragment,myFragment).commitAllowingStateLoss();
        }
    };
}
